import { INCREMENT,DECREMENT } from "./constant"
const initState = 0
export default function countReducer(preState = initState,action){
    /*if(preState=== undefined){
        preState = 0
    }*/
    console.log('reducer====>',preState,action)

    const {type,data} = action
    console.log('action===>',type,data,preState)
    switch (type) {
        case INCREMENT:
            return preState + data
            
        case DECREMENT:
            return preState - data
        default:
            return preState
            
    }
}